package com.solweaver.greetings.dao;

import java.util.List;

import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.solweaver.greetings.entity.Country;

@Repository
public class CountryDAO extends BaseDAO<Country, Long>{

	public Country findByCode(String recepientCountry) {
		Country country = null;
		if(recepientCountry != null){
			List<Country> countryList = findByCriteria(Restrictions.eq("code", recepientCountry));
			if(countryList != null && countryList.size() > 0){
				country = countryList.get(0);
			}
		}
		return country;
	}

}
